export default{
    namespaced:true,
    state: {
        count:1,
      },
      //算state
      getters: {
        countStatus(state){
          return state.count>=1
        }
      },
      //更新状态的方法-更新state的唯一方法 commit mutations
      mutations: {
        setCount(state,num){
          state.count=num
        }
      },
      //可以异步操作，更改数据还是传到mutations去改
      actions: {
        setCountPromise(context,num){
          return new Promise((resolve,reject)=>{
            if(num>100){
              reject("buneng>100")
            }else{
              context.commit("setCount",num)
              resolve()
            }
          })
    
        }
      },
      //数据多的时候，分模块
      modules: {
      }
    
}